{extend name="public:base" /}
{block name='header'}
 <style>
        /* 本例子css */
        .picFocus{ margin:0 auto;  width:600px; padding:5px;  position:relative;  overflow:hidden;  zoom:1;   }
        .picFocus .hd{ width:100%; padding-top:5px;  overflow:hidden; }
        .picFocus .hd ul{ margin-right:-5px;  overflow:hidden; zoom:1; }
        .picFocus .hd ul li{ padding-top:5px; float:left;  text-align:center;  }
        .picFocus .hd ul li img{ width:109px; height:65px; border:2px solid #ddd; cursor:pointer; margin-right:5px;   }
        .picFocus .hd ul li.on{ background:url("/upload/picture/icoUp.gif") no-repeat center 0; }
        .picFocus .hd ul li.on img{ border-color:#f60;  }
        .picFocus .bd li{ vertical-align:middle; }
        .picFocus .bd img{ width:600px; height:auto; display:block;  }
        .photo_show{
            width:370px;
            height:370px;
            position: absolute;
            border:1px solid #ccc;
            display: none;
        }
</style>
{/block}
{block name="main"}
    <div class="ShareAnyContainer" style="font-size: 14px;">
        当前位置：<a href="{:url('shop/index/index')}" title="首页">首页</a>&nbsp;&nbsp;/&nbsp;&nbsp;
        <a href="{:url('shop/artwork/group')}" title="艺术品">艺术品</a>&nbsp;&nbsp;/&nbsp;&nbsp;
         <a href="{:url('shop/artwork/group/',['id'=>$artwork['group_id']])}/" title="">    {$artwork['getgroup']['title']}
         </a>
    </div>
    <div class="ShareAnySeparate"></div>
    <div class="ShareAnyContainer">
        <table>
            <tr>
                <td valign="top" style="width:600px; padding-right:20px;">

                    <div class="picFocus">
                        <div class="bd">
                            <ul>
                                {volist name="imgs" id="carousel"}
                                    <li>
                                        <a href="{$carousel}">
                                            <img src="/{$carousel['path']}" class="photo"/></a>
                                    </li>
                                {/volist}

                            </ul>
                        </div>

                        <div class="hd">
                            <ul>
                                    {volist name="imgs" id="carousel"}
                                        <li><img src="/{$carousel['path']}"/></li>
                                    {/volist}
                            </ul>
                        </div>

                    </div>
                </td>
                <td valign="top" style="line-height: 30px;font-size: 14px; position: relative;">

                    <div class="photo_show"></div>
                    <p style="font-size: 20px;">{$artwork['title']}</p>
                    <br>
                        {notempty name='user'}
                            {if condition="$artwork['type'] == 1"}<!--一口价-->
                                <p>售价：</p>
                                <?php if($artwork['price'] == 0): ?>
                                <p style="background-color: #eee; padding:15px; text-align: center; color:#ff0000;">请拨打收藏专线询价</p>
                                <?php else: ?>
                                <p style="font-size: 20px; color:#ff0000;">￥{$artwork['price']}</p>
                                <?php endif; ?>

                            {else /}
                                <p>
                                    {if condition = "strtotime($artwork['start_time']) > time()"}
                                    拍卖尚未开始
                                    {elseif condition = "strtotime($artwork['endtime']) > time()"}
                                    拍卖进行中
                                    {else /}
                                    拍卖已经结束
                                    {/if}
                                    ，起拍价格：
                                </p>
                                <p style="font-size: 20px; color:#ff0000;">￥{$artwork['price']}</p>
                            {/if}
							

                        {else /}
                            <p style="background-color: #eee; padding:15px; text-align: center; color:#ff0000;">登录后显示价格</p>
                        {/notempty}

                    <br>
                
                        {if condition="isset($artwork['getartist']['name'])"}
                            <p>作者 · <span style="font-weight: bold;">{$artwork['getartist']['name']}</span></p>
                        {/if}

                        {if condition="isset($artwork['material'])"}
                            <p>材料 · <span style="font-weight: bold;">{$artwork['material']}</span></p>
                        {/if}

                        {if condition="isset($artwork['rongliang'])"}
                            <p>容量 · <span style="font-weight: bold;">{$artwork['rongliang']}</span></p>
                        {/if}

                        {if condition="isset($artwork['juanke'])"}
                            <p>镌刻 · <span style="font-weight: bold;">{$artwork['juanke']}</span></p>
                        {/if}

                        {if condition="isset($artwork['gongyi'])"}
                            <p>工艺 · <span style="font-weight: bold;">{$artwork['gongyi']}</span></p>
                        {/if}

                       {if condition="isset($artwork['size'])"}
                            <p>尺寸 · <span style="font-weight: bold;">{$artwork['size']}</span></p>
                        {/if}
                   
                        {if condition="isset($artwork['year'])"}
                            <p>年代 · <span style="font-weight: bold;">{$artwork['year']}</span></p>
                        {/if}
                   
                        {if condition="isset($artwork['showtime'])"}
                            <p>开展时间 · <span style="font-weight: bold;">{$artwork['showtime']}</span></p>
                        {/if}
                    
                    <p>浏览次数 · <span style="font-weight: bold;">{$artwork['read_count']}</span></p>

                    <p>关注收藏 · <span style="font-weight: bold;">{$artwork['love_count']}</span></p>
<br>

<div style="padding:0px; border:0px solid #ccc;">
    <volist name="" id="">
        <!--<p>曲哥哥 ** 出价 ￥ 10000</p>-->
    </volist>
</div>

                    <br>          <p>
                        {notempty name='user'}
                            {if condition="$artwork['type'] == 1"}<!--一口价-->
                                <a href="{:url('/shop/order/index/',array('artwork_id'=>$artwork['id']))}">
                                    <img src="__MODULE_IMG__/buy.png">
                                </a>
                                {else /}
                                <p>
                                    {if condition = "strtotime($artwork['start_time']) > time()"}

                                        <a href="javascript:alert('拍卖尚未开始');">
                                            <img src="__MODULE_IMG__/auction_now.jpg">
                                        </a>
                                    {elseif condition = "strtotime($artwork['endtime']) > time()"}
                                        <a href="javascript:auction();">
                                            <img src="__MODULE_IMG__/auction_now.jpg">
                                        </a>
                                    {else /}
                                        <a href="javascript:alert('拍卖已经结束');">
                                            <img src="__MODULE_IMG__/auction_now.jpg">
                                        </a>
                                    {/if}
                                     当前价格：
                                    <span style="font-size: 20px; color:#ff0000;">￥{$artwork['price']}</span>
                                </p>
                            {/if}
                        {/notempty}

                       {notempty name='user'}
                                {if condition="$love"}
                                    <a href="javascript:follow({$artwork['id']},1);">取消关注</a>
                                {else /}
                                    <a href="javascript:follow({$artwork['id']},0);">
                                        <img src="__MODULE_IMG__/fav.png"></a>
                                {/if}
                        {else/}
                            <a href="javascript:alert('请先登陆');">
                            <!--<a href="/shop/account/login/?redirect=artwork/detail/id//">-->
                                <img src="__MODULE_IMG__/fav.png">
                            </a>
                        {/notempty}
                    </p>
                    <br>

                    <p>收藏专线：<span style="font-weight: bold;">400 666 7899</span></p>
                    <br>

                    <p>

                    <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a>
                        <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
                        <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
                        <a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a>
                        <a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a>
                        <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
                    </div>
                    <script>window._bd_share_config = {
                        "common": {
                            "bdSnsKey": {},
                            "bdText": "",
                            "bdMini": "2",
                            "bdPic": "",
                            "bdStyle": "0",
                            "bdSize": "16"
                        }, "share": {}
                    };
                    with (document)0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
                    </p>
                </td>
            </tr>
        </table>

    </div>

    <div class="ShareAnySeparate"></div>
    <div class="ShareAnyContainer">
        <div class="line"></div>
    </div>
    <div class="ShareAnySeparate"></div>
    <div class="ShareAnyContainer">
        <div class="titleBig">
            作品描述
        </div>
    </div>
    <div class="ShareAnySeparate"></div>
    <div class="ShareAnyContainer">
        {$artwork['about']}
    </div>
    <div class="ShareAnySeparate"></div>
    <div class="ShareAnyContainer">
        <div class="line"></div>
    </div>
    <div class="ShareAnySeparate"></div>
    <div class="ShareAnyContainer">
        <div class="titleBig">
            艺术家
        </div>
    </div>
    <div class="ShareAnySeparate"></div>
    <div class="ShareAnyContainer">
        <div class="ShareAnyLeft artistBig1">
            <a href="/artist/detail/?id=">
                <img src="/{$artwork['getartist']['getimgpath']['path']}">
            </a>
        </div>
        <div class="ShareAnyLeft" style="margin-top: 50px;line-height: 30px;width:200px;">
            <p style="font-size: 16px; font-weight: bold;">{$artwork['getartist']['name']}</p>

            <p>{$artwork['getartist']['location']}</p>

            <p>{$artwork['getartist']['title']}</p>
        </div>
        <div class="ShareAnyLeft" style="line-height: 25px; width:500px;">
           {$artwork['getartist']['resume']}
        </div>
        <div class="ShareAnyClear"></div>
    </div>
    <div class="ShareAnySeparate"></div>
    <div class="ShareAnyContainer">
        <div class="line"></div>
    </div>
    <div class="ShareAnySeparate"></div>

    <div class="ShareAnyContainer">
        <div class="work_parent">
            <div class="work">
                <ul>
                    {volist name="list" id="vo"}
                        {if condition="$vo['img']['0'] neq ''"}
                            <li>
                                <a href="{:url('shop/artwork/detail',['id'=>$vo['id']])}">
                                <img src="/{$vo['img']['0']}">
                            </a>
                            <span>
                                <br>
                                《{$vo['title']}》
                                <br>

                                    作者：{$vo['getartist']['name']}
                          
                                {notempty name='user'}
                                   		 <br>价格：￥{$vo['price']}
                                {/notempty}
                            </span></li>
                        {/if}
                    {/volist}
                </ul>
            </div>
            <div class="ShareAnyClear"></div>
        </div>
    </div>


{/block}
{/block}
   
{block name="footer"}
    <script>
        function auction() {
            var price = "1000";
            if(confirm("您将出价 ￥" + price)){
                if (price) {
                    if (parseFloat(price) <= parseFloat("10000")) {
                        alert("您的出价低于当前价格");
                    }
                    else {
                        $.ajax({
                            url: "/auction/ajaxAuction/",
                            type: "POST",
                            dataType: "JSON",
                            data: {
                                price: price,
                                artwork: "1"
                            },
                            success: function (data) {
                                alert(data.message);
                                if (data.code == "1") {
                                    window.location.reload();
                                }
                                if (data.code == "2") {
                                    window.location.href = "www.baidu.com";
                                }

                            }
                        });
                    }
                }
            }

        }
        function follow(artworkid,del) {
            $.ajax({
                url: "/shop/artwork/ajaxFollow/",
                type: "POST",
                dataType: "JSON",
                data: {
                    id: artworkid,
                    del: del
                },
                success: function (data) {
                    alert(data.message);
                    if (data.code == "1") {
                        window.location.reload();
                    }
                }
            });
        }

        function getCostTime(second){
            var string1 = "";
            if(second%(60*60*24*365)>0){
                string1 += parseInt(second/(60*60*24*365)) + "年";
                second = second % (60*60*24*365);
            }
            if(second%(60*60*24)>0){
                string1 += parseInt(second/(60*60*24)) + "天";
                second = second%(60*60*24);
            }
            if(second%(60*60)>0){
                string1 += parseInt(second/(60*60)) + "小时";
                second = second%(60*60);
            }
            if(second%(60)>0){
                string1 += parseInt(second/(60)) + "分";
                second = second%(60);
            }
            string1 += parseInt(second) + "秒";
            return string1;



        }


        $(document).ready(function(){
            var timeNow = parseInt("100");
            var timeAuction = parseInt("1000");
            setInterval(function(){
                timeNow = timeNow + 1;
                if(timeNow<timeAuction){
                    var time = timeAuction - timeNow;
                    $("#last").html("，还剩"+getCostTime(time));
                }
            }, 1000);

        });


    </script>
    <script type="text/javascript">jQuery(".picFocus").slide({ mainCell:".bd ul",effect:"left",autoPlay:true });</script>
    <script>
        (function ($) {
            window.magnifier = function (basePhotoClass, showPhotoClass, scale) {
                var basePhoto = $("." + basePhotoClass);
                var showPhoto = $("." + showPhotoClass);
                var showWidth = showPhoto.width();
                var showHeight = showPhoto.height();;

                // basePhoto.each(function(){
                //     $(this).parent().css("width", $(this).width() + "px");
                //     $(this).parent().css("height", $(this).height() + "px");
                // });

                // basePhoto.parent().css("position", "relative");

                // basePhoto.css("position", "absolute");
                // basePhoto.css("cursor", "pointer");
                showPhoto.css("background-repeat", "no-repeat");

                showPhoto.hide();

                basePhoto.on("mouseout", function (e) {
                    showPhoto.hide();
                });

                basePhoto.on("mousemove", function (e) {
                    var thisLeft = e.pageX - $(this).offset().left;
                    var thisTop = e.pageY - $(this).offset().top;
                    var thisWidth = $(this).width();
                    var thisHeight = $(this).height();
                    var showBackgroundWidth = thisWidth * scale;
                    var showBackgroundheight = thisHeight * scale;
                    var backgroundPositionLeft = (showWidth / 2 - thisLeft * scale);
                    var backgroundPositionTop = (showHeight / 2 - thisTop * scale);

                    if (backgroundPositionLeft > 0) {
                        backgroundPositionLeft = 0;
                    }
                    if (backgroundPositionLeft < (showWidth - showBackgroundWidth)) {
                        backgroundPositionLeft = (showWidth - showBackgroundWidth);
                    }
                    if (backgroundPositionTop > 0) {
                        backgroundPositionTop = 0;
                    }
                    if (backgroundPositionTop < (showHeight - showBackgroundheight)) {
                        backgroundPositionTop = (showHeight - showBackgroundheight);
                    }

                    showPhoto.css("background-position", backgroundPositionLeft + "px " + backgroundPositionTop + "px");
                    showPhoto.css("background-size", showBackgroundWidth + "px " + showBackgroundheight + "px");
                    showPhoto.css("background-image", "url(" + $(this).attr("src") + ")");
                    showPhoto.show();
                });

            };
        })(jQuery);

        $(window).load(function () {
            window.magnifier("photo", "photo_show", 2);
        });
    </script>
{/block}